package com.witframework.web.extremetable;

import org.extremecomponents.table.core.TableModel;
import org.extremecomponents.util.HtmlBuilder;



/**
 * html视图类，使用了新的WsStatusBar和WsCompactToolbar
 * @see WsCompactToolbar
 * @see WsStatusBar
 * @author wuxinyang
 */
public class WsHtmlView extends AbstractHtmlView {
    protected void beforeBodyInternal(TableModel model) {

        getTableBuilder().tableStart();
        getTableBuilder().theadStart();
        //title
        //getTableBuilder().titleRowSpanColumns();
        //toolbar
        toolbar(getHtmlBuilder(), getTableModel());

        getTableBuilder().filterRow();
        getTableBuilder().headerRow();
        
        String hasComplexTitle=model.getTableHandler().getTable().getAttributeAsString("hasComplexTitle");
        if(hasComplexTitle!=null&&!hasComplexTitle.equalsIgnoreCase("true")&&!hasComplexTitle.equalsIgnoreCase("Y"))
        	getTableBuilder().getHtmlBuilder().append(hasComplexTitle).trEnd(1);
        
        getTableBuilder().theadEnd();
        getTableBuilder().tbodyStart();
    }
    protected void afterBodyInternal(TableModel model) {
        getCalcBuilder().defaultCalcLayout();

        //new DefaultStatusBar(getHtmlBuilder(), getTableModel()).layout();
        
        new WsCompactToolbarBottom(getHtmlBuilder(), getTableModel()).layout();
        getTableBuilder().tbodyEnd();
        getTableBuilder().tableEnd();


    }

    protected void toolbar(HtmlBuilder html, TableModel model) {
        new WsCompactToolbar(html, model).layout();
    }

}

